-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

=============================================================================
FreeBSD-SA-20:26.dhclient                                   Security Advisory
                                                          The FreeBSD Project

Topic:          dhclient heap overflow

Category:       core
Module:         dhclient
Announced:      2020-09-02
Credits:        Shlomi Oberman, JSOF
                Moshe Kol, JSOF
Affects:        All supported versions of FreeBSD.
Corrected:      2020-08-31 21:28:09 UTC (stable/12, 12.1-STABLE)
                2020-09-02 16:25:31 UTC (releng/12.1, 12.1-RELEASE-p9)
                2020-08-31 21:28:57 UTC (stable/11, 11.4-STABLE)
                2020-09-02 16:25:31 UTC (releng/11.4, 11.4-RELEASE-p3)
                2020-09-02 16:25:31 UTC (releng/11.3, 11.3-RELEASE-p13)
CVE Name:       CVE-2020-7461

For general information regarding FreeBSD Security Advisories,
including descriptions of the fields above, security branches, and the
following sections, please visit <URL:https://security.FreeBSD.org/>.

I.   Background

dhclient(8) is the default IPv4 DHCP client used on FreeBSD.  It is
responsible for contacting DHCP servers on a network segment, and for
initializing and configuring network interfaces and configuring name
resolution based on received information.

dhclient(8) handles DHCP option 119, the Domain Search Option, which provides
a list of domains to search when resolving names using DNS.  The option data
format uses a compression scheme to avoid transmitting duplicate domain name
labels.

II.  Problem Description

When parsing option 119 data, dhclient(8) computes the uncompressed domain
list length so that it can allocate an appropriately sized buffer to store
the uncompressed list.  The code to compute the length failed to handle
certain malformed input, resulting in a heap overflow when the uncompressed
list is copied into in inadequately sized buffer.

III. Impact

The heap overflow could in principle be exploited to achieve remote code
execution.  The affected process runs with reduced privileges in a Capsicum
sandbox, limiting the immediate impact of an exploit.  However, it is
possible the bug could be combined with other vulnerabilities to escape the
sandbox.

IV.  Workaround

No workaround is available.  To trigger the bug, a system must be running
dhclient(8) on the same network as a malicious DHCP server.

V.   Solution

Upgrade your vulnerable system to a supported FreeBSD stable or
release / security branch (releng) dated after the correction date, and
restart dhclient or reboot.

Perform one of the following:

1) To update your vulnerable system via a binary patch:

Systems running a RELEASE version of FreeBSD on the i386 or amd64
platforms can be updated via the freebsd-update(8) utility:

# freebsd-update fetch
# freebsd-update install
# shutdown -r +10min "Rebooting for a security update"

2) To update your vulnerable system via a source code patch:

The following patches have been verified to apply to the applicable
FreeBSD release branches.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

# fetch https://security.FreeBSD.org/patches/SA-20:26/dhclient.patch
# fetch https://security.FreeBSD.org/patches/SA-20:26/dhclient.patch.asc
# gpg --verify dhclient.patch.asc

b) Apply the patch.  Execute the following commands as root:

# cd /usr/src
# patch < /path/to/patch

c) Recompile the operating system using buildworld and installworld as
described in <URL:https://www.FreeBSD.org/handbook/makeworld.html>.

Restart the applicable daemons, or reboot the system.

VI.  Correction details

The following list contains the correction revision numbers for each
affected branch.

Branch/path                                                      Revision
- -------------------------------------------------------------------------
stable/12/                                                        r365010
releng/12.1/                                                      r365257
stable/11/                                                        r365011
releng/11.4/                                                      r365257
releng/11.3/                                                      r365257
- -------------------------------------------------------------------------

To see which files were modified by a particular revision, run the
following command, replacing NNNNNN with the revision number, on a
machine with Subversion installed:

# svn diff -cNNNNNN --summarize svn://svn.freebsd.org/base

Or visit the following URL, replacing NNNNNN with the revision number:

<URL:https://svnweb.freebsd.org/base?view=revision&revision=NNNNNN>

VII. References

<URL:https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-7461>

The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-SA-20:26.dhclient.asc>
-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEE/A6HiuWv54gCjWNV05eS9J6n5cIFAl9VAvlfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEZD
MEU4NzhBRTVBRkU3ODgwMjhENjM1NUQzOTc5MkY0OUVBN0U1QzIACgkQ05eS9J6n
5cLdkBAAny+0h94iQA7oB15VA53c53IFS385b0Ik7JnKYQIphkuSTio+vfCUgrGJ
vYg0Ry+HQ+asGCsCtL/SDJKnxtzcLzu+j5AV6WSbojSz8iQOoq50qWrOCulQoN/B
ghPxT0TSoQMF5hl8XV221Q15q+an/1rk275K53IXMYppbhoJ6UtLzdqssVkhw2VC
sx2NYpqXKmdipY0g0kdLxp105GevIEW0gSm7LMGESMh760ZDGKkk6YG8AO7jdhqg
u/rwwY7JIom9qddg0vmGcD5LpOoWigJRorsZYU+gNdt69Qx5q2Lv1dvFP04X1ET/
BnxxJG/ETUKk3uaBsa3QhWnb4/KkTbx4TArxo8yqAqIyOF67ZDUNsa4G8rWudNb+
9RFI8atHsdb4cpdMBZjLhMiKofJ6ICIuH2VcB+l+JQvdF/kHVamCsLQ79TBefBDc
s2ubbnmkIzSN5Jm9EfEs2dV48I7e6YDpNifGNKkvRLncf/fcsYxHXq78rufvKTby
aZbtN+daSz35yQqbIzWHwb/AaVzD7VfZUi/oeOC5ZXpVSVgyYWbG2zwN+LPkTVaa
SbuAWPG4Ngf1kpdFypA0UNW8jLNHNxBFwpKMSKAfraj0puKaX/t7kxHZvNl0EQ7v
qtJd/M9tjELQXEQrm5y/SepSPekJL6b6hW86Fpmy8EMEFshezug=
=ttv2
-----END PGP SIGNATURE-----
